package net.huashitong.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.logging.SimpleFormatter;

public class DateUtil {

    //下个季度的同一天
    public static String  nextQuarterDay(String yyyymmdd) throws ParseException {

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date  = sdf.parse(yyyymmdd);
        Calendar ca = Calendar.getInstance();
        ca.setTime(date);
        ca.add(Calendar.MONTH,3);//增加三个月
        Date newDate = ca.getTime();
        String format = sdf.format(newDate);
        System.out.println("增加3个月后："+format);

        return format;
    }

    /**
     * 获取当前日期
     * @return
     */
    public static  String getCurrentDate(){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String currentDate = sdf.format(new Date());
        return currentDate;
    }


}
